package 强化训练;

import java.util.Scanner;
import java.util.Stack;

public class day20洗牌 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int terms = sc.nextInt();//有几组数据
        //顶一个栈，先进先出
        Stack<Integer>  stack = new Stack();
        for (int k = 0; k < terms; k++) {
            int cards = sc.nextInt();//每手牌的张数
            int counts = sc.nextInt();//洗牌的次数
            int[] arr = new int[2 * cards];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = sc.nextInt();
            }
            while (counts > 0){
                for (int i = cards-1; i >= 0; i--) {
                    //小下标先入栈
                    stack.push(arr[i+cards]);//先放右手
                    stack.push(arr[i]);//在放左手
                }
                for (int i = 0; i < arr.length; i++) {
                    arr[i] = stack.pop();//将洗过一次的数据再次放入到数组中
                }
                counts--;
                if(counts == 0){
                    //输出数据
                    for (int i = 0; i < arr.length - 1; i++) {
                        System.out.print(arr[i] + " ");
                    }
                    System.out.println(arr[arr.length-1]);
                }
            }
        }
    }
}
